package com.baymax.study.security.controller;

import com.baymax.study.atomic.tools.ResultMsg;
import com.baymax.study.security.dtos.UserDto;
import com.baymax.study.security.services.LoginServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private LoginServiceImpl loginServcie;

    @PostMapping("/user/login")
    public ResultMsg login(@RequestBody UserDto user) {
        return loginServcie.login(user);
    }

    @GetMapping("/user/logout")
    public ResultMsg logout() {
        return loginServcie.logout();
    }
}

